package pattern.feign;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import pattern.feign.fallback.SocketFeignFallBack;
import pattern.model.mq.SendMessageManyModel;
import pattern.model.mq.SendMessageModel;
import pattern.model.mq.SendMessageTokenModel;
import pattern.model.mq.SendMessageTopicModel;
import pattern.result.SocketResult;

/**
 * 发送socket消息feign
 * @author Simon
 */
@FeignClient(contextId = "socketFeign", value = "${cloud.application.name.socket-server}", fallback = SocketFeignFallBack.class)
public interface SocketFeign {

    /**
     * 临时会话发送消息
     */
    @PostMapping(value = "/sendByUUID")
    SocketResult sendByUUID(@RequestBody SendMessageModel model);
    /**
     * 根据用户ID发送消息
     */
    @PostMapping(value = "/sendByUser")
    SocketResult sendByUser(@RequestBody SendMessageModel model);

    /**
     * 根据用户类型发送消息
     */
    @PostMapping(value = "/sendByUserType")
    SocketResult sendByUserType(@RequestBody SendMessageManyModel model);

    /**
     * 根据订阅主题发送消息
     */
    @PostMapping(value = "/sendByTopic")
    void sendByTopic(@RequestBody SendMessageTopicModel model);

    /**
     * 速度最快发送消息根据token
     */
    @PostMapping(value = "/sendByToken")
    void sendByToken(@RequestBody SendMessageTokenModel model);
}
